<template>
  <div class="selectUser">
    <label>{{extensionObj.labeName}}:</label>
    <input readonly v-model="extensionObj.userName" @click="chooseWindow"/>
    <van-popup v-model="show" position="bottom" :style="{ width: '100%',height:'80%' }" >
      <van-list
      style="margin-top: 10px"
      :finished="finished"
      v-model="loading"
      finished-text="没有更多了"
    >
      <van-radio-group @change="handleChange" v-model="result">
        <van-cell v-for="(item, index) in list" :key="index">
          <div class="risk_item_radio">
            <div>
              <div class="mb-10">{{ item.ChnName }}</div>
              <div>{{ item.OrgFullName }}{{item.OrgFullName!=null?'>':''}}{{item.PostName}}</div>
            </div>
            <van-radio :name="item.UserName"></van-radio>
          </div>
        </van-cell>
      </van-radio-group>
    </van-list>
    </van-popup>
    </div>

</template>

<script>
import { Popup } from 'vant';
import { getChooseUserList } from "@/api/common";
export default {
props:['extensionObj'],
  data() {
    return {
    show:false,
     list: [],
      result: "",
      loading: false,
      finished: false,
      filter: {
        dataType:'List',
        allDefault: true,
        userKind: 0,
        accounted: false,
      },
    };
  },
    created() {
    this.getList();
  },
  methods:{
    setUser:function(){
    this.$emit('transferUser', this.extensionObj.userName);
    },
    chooseWindow:function(){
this.show=true;
    },
      handleChange(id) {
      // const newData = this.list.filter((item) => item.UserName === id);
      // this.$router.push({
      //   name: "CertEdit",
      //   params: {userName:newData[0].ChnName,userCode:newData[0].UserName,id:this.id},
      // });
    },
 
   getList() {
      this.loading = true;
      getChooseUserList(this.filter)
        .then((res) => {
          this.loading = false;
          this.list = res.data;
          this.finished = true;
          //this.filter.page = res.data.PageIndex;
        })
        .catch((err) => {
          this.finished = true;
        });
    },
     },
};
</script>

